#![allow(unused)]
#![no_std]
#![no_main]
#![feature(panic_info_message)]
#[macro_use]
use core::arch::global_asm;
use core::panic::PanicInfo;

mod lang_items;
mod console;
mod sbi_call;
mod sys_call;
mod app_manager;
mod log;

fn clear_bss() {
    extern "C" {
        fn sbss();
        fn ebss();
    }
    (sbss as usize..ebss as usize).for_each(|a| {
        unsafe { (a as *mut u8).write_volatile(0) }
    });
}

global_asm!(include_str!("entry.asm"));

#[no_mangle]
pub fn rust_main() -> () {
    clear_bss();
    // log::log.set_lever(log::LogLevers::TRACE);
    // set_log_lever!(lever);
    trace!("this os named trace");
    debug!("this os named debug");
    info!("this os named info");
    warning!("this os named warning");
    error!("this os named error");
    notice!("this os named notice");
    fatal!("this os named fatal");
    sbi_call::shutdown();
}